import { _decorator, Component, Node, Camera, UITransform, Vec3 } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('BattleCamera')
export class BattleCamera extends Component {


    @property(Camera)
    camera: Camera;


    //缩放
    shake(e) {
        // this.camera.node.stopActionByTag(1), (e = e || 1);
        // var r = [];
        // this.camera.node.y = 0;
        // for (var n = 0; n < e; n++) r.push(cc.moveBy(0.05, 0, 5)), r.push(cc.moveBy(0.05, 0, -5));
        // var t = cc.sequence(r);
        // t.setTag(1), this.camera.node.runAction(t);
    }
    moveBy(e, r, n) {
        var t = [];
        // t.push(cc.moveBy(r, e)),
        //     t.push(
        //         cc.callFunc(function () {
        //             n && n(), CustomsEvent.dispatch("BATTLE_CAMERA_MOVE_OVER");
        //         })
        //     ),
        //     this.camera.node.runAction(cc.sequence(t));
    }
    getOffset() {
        return this.camera.node.getPosition();
    }
    changeX(e) {
        // this.camera.node.x += e;
        this.camera.node.position.add(new Vec3(e, 0, 0));

    }
    reset() {
        var e = this.camera.node.getPosition();
        return this.camera.node.setPosition(0, 0), CustomsEvent.dispatch("BATTLE_CAMERA_RESET", e), e;
    }

    start() {

    }

    update(deltaTime: number) {

    }
}


